package com.welink.admin.controller;

import com.welink.admin.entity.User;
import com.welink.admin.service.UserService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author welink
 * @since 2025-04-03
 */
@RestController
@Api(tags = "用户管理接口")
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID获取用户", notes = "根据用户ID获取用户详细信息") // Swagger2
    // @Operation(summary = "根据ID获取用户", description = "根据用户ID获取用户详细信息") // OpenAPI 3.0
    @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long", paramType = "path") // Swagger2
    // @Parameter(name = "id", description = "用户ID", required = true) // OpenAPI 3.0
    public User getUserById(@PathVariable Long id) {
        // 实现代码
        User user = new User();
        userService.list();
        return user;
    }

    @PostMapping
    @ApiOperation("创建用户")
    // @Operation(summary = "创建用户")
    public User createUser(
            @RequestBody
            @ApiParam(value = "用户信息", required = true) // Swagger2
            // @Parameter(description = "用户信息", required = true) // OpenAPI 3.0
            User user) {
        // 实现代码
        return user;
    }

}
